const ConfigModel = require("@/git-submodule/lee-common-js/configModel");
const {
	ENUM_CACHE_TYPE
} = require("@/git-submodule/lee-common-js/static/enum");
const CACHE_KEY = require("@/common/values/cache-keys.js");
const ProjectConfig = require("@/config/index.js");
const {
	NOTIFICATION_REFRESH_TOKEN,
	NOTIFICATION_REFRESH_TOKEN_SUCCESS
} = require("@/common/values/notification-keys");

const LeeCommonJsConfig = new ConfigModel({
	projectName: "宠趣趣",
	defaultShareTitle: "宠趣趣运宠，安全放心",
	defaultSharePagePath: "/pages/guide/guide",
	requestConfig: {
		baseUrl: ProjectConfig.default.BASE_URL,

		tokenPassWhiteList: [
			"*/front-api/system/auth/send-sms-code*",
			"*/front-api/system/auth/sms-login*",
			"*/front-api/system/auth/login*",
			"*/front-api/system/dict-data/list-all-simple*",
			"*/front-api/system/auth/refresh-token*"
		],

		successStatusCode: 200,
		successCode: 200,
		reloginCode: 401,

		refreshTokenNotificationKey: NOTIFICATION_REFRESH_TOKEN,
		refreshTokenNotificationSuccessKey: NOTIFICATION_REFRESH_TOKEN_SUCCESS,

		accessTokenCacheKey: CACHE_KEY.CACHE_ACCESS_TOKEN
	},
	componentsConfig: {
		defaultEmptyImgSource: "/static/c-empty/empty.png"
	},
	cacheConfig: [
		/** =============== Memory 有期限缓存 ==================*/
		{
			// 笼具列表数据缓存
			key: CACHE_KEY.CACHE_CAGE_LIST,
			expireTime: 1000 * 60 * 10, // 10分钟
			type: ENUM_CACHE_TYPE.MEMORY.value, // memory
		}, {
			// 增值服务列表数据缓存
			key: CACHE_KEY.CACHE_VALUE_ADDED_LIST,
			expireTime: 1000 * 60 * 10, // 10分钟
			type: ENUM_CACHE_TYPE.MEMORY.value, // memory
		},
		/** ================Storage 无期限缓存==================*/
		{
			// OPENID
			key: CACHE_KEY.CACHE_OPENID,
			expireTime: 0, // 0表示不过期
			type: ENUM_CACHE_TYPE.STORAGE.value // storage
		},
		{
			// 用户信息	
			key: CACHE_KEY.CACHE_USER_INFO,
			expireTime: 0, // 0表示不过期
			type: ENUM_CACHE_TYPE.STORAGE.value, // storage
		},
		{
			// token
			key: CACHE_KEY.CACHE_ACCESS_TOKEN,
			expireTime: 0, // 0表示不过期
			type: ENUM_CACHE_TYPE.STORAGE.value, // storage	
		},
		{
			// 用户专属客服
			key: CACHE_KEY.CACHE_USER_SERVER,
			expireTime: 0, // 0表示不过期
			type: ENUM_CACHE_TYPE.STORAGE.value, // storage	
		},
		{
			// 用户推荐码
			key: CACHE_KEY.CACHE_USER_REFERRAL_CODE,
			expireTime: 0, // 0表示不过期
			type: ENUM_CACHE_TYPE.STORAGE.value, // storage
		}
	]
})

module.exports = LeeCommonJsConfig